﻿@{
    List<KeppelLand.Entities.Claim> claimList = PageData[0];
    KeppelLand.Entities.ClaimSummary claimSummary = PageData[1];    
}
@if ((claimList != null) && (claimList.Count > 0))
{
    <form method="post" id="approval_form">

        <table class="table table-striped table-bordered" id="pending_action_claim_list">
            <thead>
                <tr>
                    <td colspan="11"></td>
                    <td colspan="5" class="text-nowrap" style="font-weight:bold; color:red;">No of overtime hours worked(excl. breaks)</td>
                    <td colspan="4"></td>
                </tr>
                <tr>
                    <th rowspan="2" style="width:50px;">Section</th>
                    <th rowspan="2" style="width:280px;">Claimant</th>
                    <th rowspan="2" style="width:136px">Claim Date</th>
                    <th rowspan="2" style="width:90px"><span class="text-nowrap">Shift Type</span>(for shift staff only)</th>
                    <th colspan="2" class="text-center">Official Hours</th>
                    <th colspan="2" style="width:1px" class="text-center">Overtime Hours</th>
                    <th rowspan="2" style="width:55px" class="text-center">Total OT Hours</th>
                    <th rowspan="2" style="width:55px" class="text-center">Break Hours</th>
                    <th colspan="2" class="text-center">OT Rate <span class="glyphicon glyphicon-info-sign" style="color:black;font-size:large;cursor:pointer;vertical-align:middle;" title="Information" aria-hidden="true" onclick="javascript: $('#otRateModal').modal('show');"></span></th>
                    <th rowspan="2" style="width:1px;cursor:default;text-align:center;" title="Public Holiday">PH</th>
                    <th colspan="2" class="text-center" style="white-space:nowrap;">Rest Day</th>
                    <th rowspan="2" style="width:90px;"><span class="text-nowrap">Meal Allw($)</span> <span class="glyphicon glyphicon-info-sign" style="color:black;font-size:large;cursor:pointer;vertical-align:middle;" title="Information" aria-hidden="true" onclick="javascript: $('#mealAllwModal').modal('show');"></span></th>
                    <th rowspan="2" style="width:90px;"><span class="text-nowrap">Shift Allw($)</span> (for shift staff only)</th>
                    <th rowspan="2" style="width:90px;">Description of Work Performed During Overtime Hours Worked</th>

                    <th rowspan="2" style="width:1px;" class="text-center">
                        Tick<br/>
                        <input type="checkbox" id="checkbox_select_all" />
                    </th>
                </tr>
                <tr>
                    <th style="white-space:nowrap;width:1px;">Start Time</th>
                    <th style="white-space:nowrap;width:1px;">End Time&nbsp;</th>
                    <th style="white-space:nowrap;width:1px;">Start Time</th>
                    <th style="white-space:nowrap;width:1px;">End Time&nbsp;</th>
                    <th style="white-space:nowrap;width:1px;text-align:center;">1.5 X</th>
                    <th style="white-space:nowrap;width:1px;text-align:center;">2.0 X</th>
                    <th style="white-space:nowrap;width:1px;text-align:center;">&lt;4</th>
                    <th style="white-space:nowrap;width:1px;text-align:center;">&gt;4</th>
                </tr>
            </thead>
            <tbody>
                @foreach (KeppelLand.Entities.Claim c in claimList)
                {
                <tr>
                    <td style="white-space:nowrap;">@DisplayHelper.SectionByEmployeeMaster(c.EntryOwner)</td>
                    <td>@DisplayHelper.LegalNameByEmployeeMaster(c.EntryOwner)</td>
                    <td style="white-space:nowrap;">@DisplayHelper.FormatDate(c.ClaimDate) (@DisplayHelper.FormatDayOfWeek(c.ClaimDate))</td>
                    <td>@c.ShiftType</td>
                    <td>@DisplayHelper.FormatTime(c.StartWorkTime)</td>
                    <td>@DisplayHelper.FormatTime(c.EndWorkTime)</td>
                    <td>@DisplayHelper.FormatTime(c.StartOverTime)</td>
                    <td>@DisplayHelper.FormatTime(c.EndOverTime)</td>
                    <td class="text-right">@c.TotalOTHours</td>
                    <td class="text-right">@c.BreakHours</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(c.OT1_5)</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(c.OT2_0)</td>
                    <td style="text-align:center;">@DisplayHelper.FormatCheckmark(c.PH)</td>
                    <td style="text-align:center;">@DisplayHelper.FormatCheckmark(c.RD4)</td>
                    <td style="text-align:center;">@DisplayHelper.FormatCheckmark(c.RD8)</td>
                    <td class="text-right">@DisplayHelper.FormatMoney(c.AlwMeal)</td>
                    <td class="text-right">@DisplayHelper.FormatMoney(c.AlwShft)</td>

                    <td>@c.Remark</td>
                    <td class="text-center">
                        <input type="checkbox" name="selected_id" value="@c.Id" class="checkbox_selected_id" />
                    </td>
                </tr>
                }
            </tbody>
            @if (claimSummary != null)
            {
            <tfoot>
                <tr>
                    <th colspan="8" class="text-right">Total </th>
                    <td class="text-right">@DisplayHelper.FormatDecimal(claimSummary.Total_OT_Hours)</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(claimSummary.Break_Hours)</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(claimSummary.OT1_5)</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(claimSummary.OT2_0)</td>
                    <td class="text-center">@DisplayHelper.FormatInteger(claimSummary.PH)</td>
                    <td class="text-center">@DisplayHelper.FormatInteger(claimSummary.RD4)</td>
                    <td class="text-center">@DisplayHelper.FormatInteger(claimSummary.RD8)</td>
                    <td class="text-right">@DisplayHelper.FormatMoney(claimSummary.AlwMeal)</td>
                    <td class="text-right">@DisplayHelper.FormatMoney(claimSummary.AlwShft)</td>
                    <td colspan="2"></td>
                </tr>
            </tfoot>
            }
        </table>

        <div>

            <button type="button" name="actionButton" value="approve" id="actionButton_approve" class="btn btn-primary actionButton"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Approve</button>
            <button type="button" name="actionButton" value="reject" id="actionButton_reject" class="btn btn-primary actionButton"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Reject</button>

            <div class="btn-group">
                <button type="button" class="btn btn-primary btn-download" onclick="download('PDF');"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> Download as PDF</button>
                <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <span class="caret"></span>
                    <span class="sr-only">Toggle Dropdown</span>
                </button>
                <ul class="dropdown-menu" role="menu">
                    <li onclick="download('Excel');"><a href="javascript:void(0);" class="btn-download">Download as Excel</a></li>
                    <li onclick="download('WORD');"><a href="javascript:void(0);" class="btn-download">Download as Word</a></li>
                    <li onclick="download('IMAGE');"><a href="javascript:void(0);" class="btn-download">Download as TIFF</a></li>
                </ul>
            </div>
        </div>
        
        <input type="hidden" name="actionButton" id="actionButton" />
        <input type="hidden" name="rejection_reason" id="rejection_reason" />
        <input type="hidden" name="download_format" id="download_format" />
        <input type="hidden" name="download_filter_entries" id="download_filter_entries" />
        <input type="hidden" name="filter_entries" id="filter_entries" />
        
    </form>

<p>&nbsp;</p>
}
else
{
    <h2>Claims pending action</h2>

    <p>There are no claims pending your action.</p>

    <p>&nbsp;</p>
}